const Mock = require('mockjs')
const foreshop = Mock.mock({
  'list|4': [
    {
      id: '@id',
      img: '@image(100x100,@color)',
      'money|10-1000': 0,
    },
  ],
})
const allkill = Mock.mock({
  'list|10': [
    {
      id: '@id',
      img: '@image(100x100,@color)',
      title: '@ctitle',
      text: '@cword(10,20)',
      'money|0-100': 0,
      'lastMoney|100-200': 0,
      'JD|0-100': 0,
    },
  ],
})
const homeData = Mock.mock({
  data: [
    {
      title: '@ctitle(4)',
      img: '@image(100x100,@color)',
      'price|1-5': 1,
    },
  ],
})
const homeList = Mock.mock({
  'list|10': [
    {
      title: '@ctitle(4)',
      img: '@image(100x100,@color)',
      'price|1-5': 1,
    },
  ],
})

let datalist = Mock.mock({
  'list|10': [
    {
      title: '@ctitle(20,22)',
      desc: '@cword(60,80)',
      id: '@id',
      url: '@image(90x90,@color)',
      'price|100-200': 101,
      num: 1,
      flag: false,
    },
  ],
})
let pj = Mock.mock({
  'list|6': [
    {
      url: '@image(50x50,@color)',
      name: '@cname(3,5)',
      title: '@ctitle(10,15)',
      'num|1-10': 2,
      id: '@id',
      'urls|4': '@image(120x120,@color)',
    },
  ],
})
let addcar = Mock.mock({
  'list|10': [
    {
      title: '@ctitle(18,22)',
      imgs: '@image(90x90,@color)',
      'price|100-200': 101,
      id: '@id',
      flag: false,
      count: 1,
      hh: '@word(15,22)',
    },
  ],
})

Mock.mock('/api/list', {
  'list|6': [
    {
      id: '@id',
      title: '@cword(4)',
      'children|8': [
        {
          id: '@id',
          title: '@cword(4)',
          url: '@image(100x100,@color)',
        },
      ],
    },
  ],
})

Mock.mock('/api/card', {
  'card|8': [
    {
      id: '@id',
      'flag|1-4': 1,
      text: '@cword(14,25)',
      name: '@cname',
      'price|444-666': 456,
      'price2|344-566': 356,
    },
  ],
})
Mock.mock('/api/pjlist', () => {
  return pj.list
})
Mock.mock('/api/getlist', () => {
  return datalist.list
})
Mock.mock('/api/carlist', () => {
  return addcar.list
})
Mock.mock('/api/card', {
  'card|8': [
    {
      id: '@id',
      'flag|1-4': 1,
      text: '@cword(14,25)',
      name: '@cname',
      'price|444-666': 456,
      'price2|344-566': 356,
    },
  ],
})
const navList = Mock.mock({
  'navlist|4': [
    {
      pp: '@ctitle(4)',
      xx: '@ctitle(4)',
      'children|6': [
        {
          title: '@ctitle(4)',
          img: '@image(100x100,@color)',
          'price|1-5': 1,
        },
      ],
    },
  ],
})
const cheapList = Mock.mock({
  'list|5-11': [
    {
      id: '@id',
      url: '@image(50x50,@color)',
      name: '@cname',
      'num|50-99': 50,
      'price|100-188': 111,
    },
  ],
})
const shopticket = Mock.mock({
  list: [
    {
      title: '未使用',
      'children|3-8': [
        {
          'starttime|10000000000-99999999999': 10000000000,
          'endtime|10000000000-99999999999': 10000000000,
          'killprice|5-100': 5,
          'price|6-100': 6,
          type: '@ctitle(2)',
        },
      ],
    },
    {
      title: '已使用',
      'children|3-8': [
        {
          'starttime|10000000000-99999999999': 10000000000,
          'endtime|10000000000-99999999999': 10000000000,
          'killprice|5-100': 5,
          'price|6-100': 6,
          type: '@ctitle(2)',
        },
      ],
    },
    {
      title: '已过期',
      'children|3-8': [
        {
          'starttime|10000000000-99999999999': 10000000000,
          'endtime|10000000000-99999999999': 10000000000,
          'killprice|5-100': 5,
          'price|6-100': 6,
          type: '@ctitle(2)',
        },
      ],
    },
  ],
})
const showList = Mock.mock({
  'list|60': [
    {
      img: '@image(130x130,@color)',
      title: '@ctitle(15,20)',
      'price|1-888': 1,
      'num|1-100': 2,
      'url|10': '@image(130x130,@color)',
    },
  ],
})
const showsList = Mock.mock({
  'list|30': [
    {
      url: '@image(120x120,@color)',
      title: '@ctitle(15,20)',
      'num|1-100': 2,
    },
  ],
})
const groupList=Mock.mock({
  "list|8-10":[{
    "price|10-100":10,
    url:"@image(100x100)",
    names:"@cname",
    "max|1-19":1,
    "num|10-20":10
  }]
})
module.exports = {
  foreshop,
  allkill,
  homeData,
  homeList,
  navList,
  showsList,
  cheapList,
  shopticket,
  showList,
  showsList,
  groupList
}
